<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>triangle</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .triangle,.triangle1{
            width: 30px;
            height: 30px;
            border: 20px solid;
            border-color: firebrick orange blueviolet greenyellow;
        }
        /* 向下的三角 */
        .triangle1{
            width: 0;
            height: 0;
            margin-top: 10px;
            border-color:red transparent transparent transparent ;
        }
        /* 向右的三角 */
        .triangle2{
            width: 0;
            padding: 0;
            margin: 20px;
            border: 30px solid ;
            border-color:transparent transparent transparent green ;
        }
        /* 两个直角三角形，组成矩形 */
        .triangle3{
            width: 0;
            height: 0;
            border-style:solid ;
            border-width: 0px 60px 30px 0px;
            border-color:red green pink blue ;
        }
        /* 左下角是直角，右边长，上边短 */
        .triangle4{
            width: 0;
            height: 0;
            border-style:solid ;
            border-width: 0px 120px 50px 0px;
            border-color:red transparent hotpink blue ;
        }

        /* 看似透明的三角 */
        .box{
            width: 200px;
            height: 300px;
            border: 1px solid black;
            position: relative;
            top: 60px;
        }
        .content1{
            width: 0;
            height: 0;
            border: 20px solid;
            border-color: transparent transparent black transparent;
            position: absolute;
            top: -40px;
            left: 40px;
        }
        .content2{
            width: 0;
            height: 0;
            border: 20px solid;
            border-color: transparent transparent white transparent;
            position: absolute;
            top: -38px;
            left: 41px;
        }
    </style>
</head>
<body>
    <!-- 三角形，思路:利用边框做出效果-->
    <div class="triangle"></div>
    <div class="triangle1"></div>
    <div class="triangle2"></div>
    <div class="triangle3"></div>
    <div class="triangle4"></div>

    <!-- 看似透明的三角，下拉框中的三角 -->
    <div class="box">
        <div class="content1"></div>
        <div class="content2"></div>
    </div>
</body>
</html>